﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Model;
using BLL;
namespace UI
{
    public partial class 修改密码 : Form
    {
        private string p;

        public 修改密码()
        {
            InitializeComponent();
        }

        public 修改密码(string p)
        {
           
            this.p = p;
            InitializeComponent();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
            {
                textBox2.UseSystemPasswordChar = false;
            }
            else
            {
                textBox2.UseSystemPasswordChar = true;
            }
        }

        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox2.Checked == true)
            {
                textBox3.UseSystemPasswordChar = false;
            }
            else
            {
                textBox3.UseSystemPasswordChar = true;
            }
        }

        private void 修改密码_Load(object sender, EventArgs e)
        {
            textBox1.Text = p;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ModelAdmins.UserName = textBox1.Text;
            ModelAdmins.UserPWD = textBox2.Text;
            object BLLlof =BLLLoginForm.DengLu();
            if (BLLlof != null)
            {
                ModelAdmins.UserPWD = textBox3.Text;
                int a = BLLLoginForm.XGMiMa();
                if (a > 0)
                {

                    MessageBox.Show("修改成功");
                }
            }
            else
            {
                MessageBox.Show("账号或者密码错误，修改失败");
            }
        }

      
    }
}
